package cn.tx.controller;

import java.util.List;

import cn.tx.model.StoreDetail;
import cn.tx.query.StoreDetailQuery;
import cn.tx.service.StoreDetailService;
import cn.tx.util.Page;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ModelDriven;

public class StoreDetailAction extends BaseAction implements ModelDriven<StoreDetail>{
	
	private StoreDetail storeDetail = new StoreDetail();
	
	private StoreDetailService storeDetailService;
	
	
	
	
	public StoreDetail getStoreDetail() {
		return storeDetail;
	}

	public void setStoreDetail(StoreDetail storeDetail) {
		this.storeDetail = storeDetail;
	}

	/**
	 * 查询对象
	 */
	private StoreDetailQuery erpQuery = new StoreDetailQuery();
	
	
	public StoreDetailService getStoreDetailService() {
		return storeDetailService;
	}

	public void setStoreDetailService(StoreDetailService storeDetailService) {
		this.storeDetailService = storeDetailService;
	}
	

	public StoreDetailQuery getErpQuery() {
		return erpQuery;
	}

	public void setErpQuery(StoreDetailQuery erpQuery) {
		this.erpQuery = erpQuery;
	}

	/**
	 * 查询员工的列表
	 * @return
	 */
	public String storeDetail_detaillist(){
		//获得action的容器
		ActionContext context = ActionContext.getContext();
		Page page = storeDetailService.selectObjectByConditionPage(erpQuery, exclude);
		context.put("page", page);
		
		return SUCCESS;
	}
	
	/**
	 * 跳转到添加页面
	 * @return
	 */
	public String storeDetail_input(){
		
		return SUCCESS;
	}
	/**
	 * 跳转到修改页面
	 * @return
	 */
	public String storeDetail_preupdate(){
		storeDetail = storeDetailService.getObjectById(storeDetail.getDetailId());
		return SUCCESS;
	}
	/**
	 * 保存
	 * @return
	 */
	public String storeDetail_save(){
		storeDetailService.save(storeDetail);
		return TOLIST;
	}
	/**
	 * 修改
	 * @return
	 */
	public String storeDetail_update(){
		storeDetailService.update(storeDetail);
		return TOLIST;
	}
	/**
	 * 修改
	 * @return
	 */
	public String storeDetail_delete(){
		storeDetail = storeDetailService.getObjectById(storeDetail.getDetailId());
		storeDetailService.delete(storeDetail);
		return TOLIST;
	}

	@Override
	public StoreDetail getModel() {
		return storeDetail;
	}
	
	
	
	

}
